<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>learn react</title>
    <script src="js/react.js"></script>
    <script src="js/react-dom.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
  </head>
  <body>
    <div id="example"></div>
    <script type="text/babel">
    /*
      对传入数据进行验证
     */
    var data = 123

    var MyTitle = React.createClass({
      propTypes: {
        title: React.PropTypes.string.isRequired
      },

      render: function() {
        return <h1> {this.props.title} </h1>
      }
    })
      ReactDOM.render(
        <MyTitle title={data} />,
        document.getElementById('example')
      )
    </script>
  </body>
</html>
